﻿using System.Data;
using CommunityToolkit.Mvvm.ComponentModel;
using Sensor.SerialPorts;
using Sensor.SerialPorts.Enums;

namespace Sensor.UI.ViewModels;

public partial class SerialConfigViewModel : ViewModelBase
{
    //[ObservableProperty]
    //private Array _port;

    [ObservableProperty]
    private List<string> _port;

    [ObservableProperty]
    private List<int> _baudRate;

    [ObservableProperty]
    private List<ParityBit> _parityBit;

    [ObservableProperty]
    private List<StopBit> _stopBit;

    [ObservableProperty]
    private List<int> _dataBit;

    public SerialConfigViewModel()
    {
        //Port = Enum.GetValues(typeof(Port));
        
        Port = SerialPortHelp.GetPortNames();

        BaudRate = [110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200];
        ParityBit = [.. Enum.GetValues<ParityBit>()];
        StopBit = [.. Enum.GetValues<StopBit>()];
        DataBit = [6, 7, 8];
    }
}